#ifndef _BLOGFILE_HEADER_
#define _BLOGFILE_HEADER_
#include "BUtils.h"
#include <stdio.h>

#define LOG_IT(file,level,data,tri) file.logInfo(level, data, tri )

#define BLOG_FILENAME_SIZE		100
#define BLOG_TIMESTAMP_SIZE		50
#define BLOG_MAX_LOGENTRY_SIZE	100000
#define BLOG_TS_BUFFER_SIZE 	29
#define BLOG_MAX_LOGINFO_SIZE	999971


namespace blueberry
{
	class BLogger
	{
	public:
		BLogger(const char * _zFilename, Byte _btLogLevel, bool _bIsNewfile = false);
		inline Byte getLogLevel()const {return bt_LogLevel;}
		inline void setLogLevel(Byte _btLogLevel){ bt_LogLevel = _btLogLevel;}
		void logInfo(Byte _btLogLevel,const char * _zInfo, ...);
		virtual ~BLogger();
	private:
		void setTimestamp();
		char z_Filename[BLOG_FILENAME_SIZE];
		FILE * fp_Logger;
		UInt ui_LastSecond;
		UInt ui_LastTSBufPos;
		Byte bt_LogLevel;
		char z_LogBuffer[BLOG_MAX_LOGENTRY_SIZE];
	};
}

#endif /* _B_MFILE_H_ */
